package experiment1.closestpoints;

import java.util.Arrays;

public abstract class ClosestPoints {
    double minDis;
    long time;

    public String result(){
        String className = this.getClass().getName();
        StringBuilder s =  new StringBuilder(className.substring(className.lastIndexOf(".")+1) + " cost " + time + "ms,minDistances:"+minDis);
        return s.toString();
    }

    public void solve(Point[] points){
        long start,end;
        Arrays.sort(points);
        start = System.currentTimeMillis();
        minDis = solve(points,0,points.length - 1);
        end   = System.currentTimeMillis();
        time = end - start;
    }

    public abstract double solve(Point[] points, int i, int i1);

}

